<template>
  <div v-if="seventh[0]">
    <div class="sofa margin">
      <div class="single-good" v-for="item in seventh[0].banners" :key="item.id" @click="handleGroup(item.bannerLinkTargetId)">
        <img :src="item.bannerImgSrc" alt="">
      </div>
    </div>
    <div class="margin">
      <img :src="seventh[1].bannerImgSrc" alt="">
    </div>
    <div class="margin">
      <img :src="seventh[2].bannerImgSrc" alt="">
    </div>
    <div class="brand-img margin">
      <div class="single-brand" :key="item.id" v-for="item in seventh[3].banners" @click="handleBrand(item.bannerLinkTargetId)">
        <img :src="item.bannerImgSrc" alt="">
      </div>
    </div>
    <div class="brand-img margin">
      <div class="single-brand" :key="item.id" v-for="item in seventh[4].banners" @click="handleBrand(item.bannerLinkTargetId)">
        <img :src="item.bannerImgSrc" alt="">
      </div>
    </div>
    <div class="brand-img margin">
      <div class="single-brand" :key="item.id" v-for="item in seventh[5].banners" @click="handleBrand(item.bannerLinkTargetId)">
        <img :src="item.bannerImgSrc" alt="">
      </div>
    </div>
    <div class="brand-img margin">
      <div class="single-brand" :key="item.id" v-for="item in seventh[6].banners" @click="handleBrand(item.bannerLinkTargetId)">
        <img :src="item.bannerImgSrc" alt="">
      </div>
    </div>
    <div class="margin">
      <img :src="seventh[7].bannerImgSrc" alt="">
    </div>
    <eightdata></eightdata>
  </div>
</template>

<script>
import axios from 'axios'
import eightdata from './eight'
export default {
  data () {
    return {
      seventh: []
    }
  },
  mounted () {
    window.onscroll = () => {
      if ((document.documentElement.scrollTop + document.documentElement.clientHeight) === document.documentElement.scrollHeight) {
        axios.get('/v2/page?pageId=1&tabId=1&currentPage=7&pageSize=8&_=1583394681448').then(res => {
          this.seventh = res.data.data.modules.map(item => item.moduleContent)
        })
      }
    }
  },
  destroyed () {
    window.onscroll = null
  },
  components: {
    eightdata
  },
  methods: {
    handleGroup (targetId) {
      this.$router.push(`/productGroup/${targetId}`)
    },
    handleBrand (brandId) {
      this.$router.push(`/brand/${brandId}`)
    }
  }
}
</script>

<style lang="scss" scoped>
img {
  width: 100%;
}
.sofa{
  display: flex;
  background: white;
  padding: 30px 15px 10px 15px;
  justify-content: space-between;
  .single-sofa{
    width: 48%;
  }
}
.chairs{
  display: flex;
  padding:50px 15px 10px 15px;
  background: white;
  justify-content: space-between;
  .single-chair{
    width: 30%;
  }
}
.brand-img{
  display: flex;
  background: white;
  padding: 30px 15px 10px 15px;
  justify-content: space-between;
  .single-brand{
    width: 32%;
  }
}
</style>
